package com.wangyadong.hobby.schedule.jobtask.dsa.binaryTree;

import java.util.Iterator;

public interface Tree<E> extends Iterable {

    //acessor method
    Position<E> root();

    Position parent(Position<E> position) throws IllegalArgumentException;

    Iterable<Position<E>> children(Position<E> position) throws IllegalArgumentException;

    //query method
    boolean isInternal(Position position) throws IllegalArgumentException;

    boolean isExternal(Position position) throws IllegalArgumentException;

    boolean isRoot(Position position) throws IllegalArgumentException;

    int numChildren(Position<E> position) throws IllegalArgumentException;

    int size();

    boolean isEmpty();

    @Override
    Iterator iterator();

    Iterable<Position<E>> positions();

    Position<E> getElement();
}
